/*!
 * 站点共用JS
 */

$(function() {
	/// 头部搜索JS
	$("#sTab a").click(function() {
		$("#sTxt").val($(this).attr("value"));
		$("#sTab a").removeClass("on");
		$(this).addClass("on");
	});
	
	$("#sTxt").blur(function() {
		if ($(this).val().trim() == "") {
			$(this).val($("#sTab a.on").attr("value"));
		}
	});
	
	$("#sBtn").click(function() {
		var keyword = $("#sTxt").val();
		var url = $("#sTab a.on").attr("s");
		if ($("#sTab a.on").attr("value") !=  keyword) {
			url = url.replace("__keyword__", $("#sTxt").val());
			document.location.href = url;
		}
	});
	
	/// 头部搜索JS
	$("#btnFavorite").click(function() {
		var company = "易购GO_淘宝网女装新款_淘宝网商城_淘宝网网上购物";
		var url = "http://www.e35go.com";
		if (document.all) {
			window.external.addFavorite(url, company);
		} else if (window.sidebar) {
			window.sidebar.addPanel(company, url, "");
		}
		return false;
	});
});
